package com.xjh.utils.util;

import com.alibaba.fastjson2.JSON;

import java.util.Map;

/**
 * @author XuJianHua
 * @date 2022-08-30 09:41:20
 * @description
 */
public class test {
    public static void main(String[] args) {
        /*
        info
            --sp_no
            --sp_status
            --apply_time
            --applyer(map)
                --user_id
            --sp_record
            --notifyer
                --userid
            --apply_data
                --contents(list)
                    --title(list)
                        --text(字段中文名)
                        --value
                            --text(字段值)

        * * * */
        PaymentApplication paymentApplication = new PaymentApplication();
        String approvalDetail = "\t{ \"errcode\": 0, \"errmsg\": \"ok\", \"info\": { \"sp_no\": \"202208290005\", \"sp_name\": \"付款申请\", \"sp_status\": 4, \"template_id\": \"1970325006023083_1688851476324306_583259002_1524556136\", \"apply_time\": 1661742687, \"applyer\": { \"userid\": \"57818\", \"partyid\": \"744\" }, \"sp_record\": [ { \"sp_status\": 2, \"approverattr\": 1, \"details\": [ { \"approver\": { \"userid\": \"85655\" }, \"speech\": \"\", \"sp_status\": 2, \"sptime\": 1661742696, \"media_id\": [] } ] }, { \"sp_status\": 2, \"approverattr\": 1, \"details\": [ { \"approver\": { \"userid\": \"99040\" }, \"speech\": \"\", \"sp_status\": 2, \"sptime\": 1661742728, \"media_id\": [] } ] }, { \"sp_status\": 1, \"approverattr\": 1, \"details\": [ { \"approver\": { \"userid\": \"78226\" }, \"speech\": \"\", \"sp_status\": 1, \"sptime\": 0, \"media_id\": [] } ] }, { \"sp_status\": 1, \"approverattr\": 1, \"details\": [ { \"approver\": { \"userid\": \"31049\" }, \"speech\": \"\", \"sp_status\": 1, \"sptime\": 0, \"media_id\": [] } ] }, { \"sp_status\": 1, \"approverattr\": 1, \"details\": [ { \"approver\": { \"userid\": \"20784\" }, \"speech\": \"\", \"sp_status\": 1, \"sptime\": 0, \"media_id\": [] } ] } ], \"notifyer\": [ { \"userid\": \"96332\" }, { \"userid\": \"22679\" }, { \"userid\": \"78226\" }, { \"userid\": \"42614\" } ], \"apply_data\": { \"contents\": [ { \"control\": \"Textarea\", \"id\": \"item-1494251039326\", \"title\": [ { \"text\": \"付款事由\", \"lang\": \"zh_CN\" } ], \"value\": { \"text\": \"1\", \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Text\", \"id\": \"item-1494251166594\", \"title\": [ { \"text\": \"收款人全称\", \"lang\": \"zh_CN\" } ], \"value\": { \"text\": \"1\", \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Text\", \"id\": \"item-1494251194643\", \"title\": [ { \"text\": \"开户行\", \"lang\": \"zh_CN\" } ], \"value\": { \"text\": \"1\", \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Textarea\", \"id\": \"item-1494251203122\", \"title\": [ { \"text\": \"备注说明\", \"lang\": \"zh_CN\" } ], \"value\": { \"text\": \"1\", \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 0 }, { \"control\": \"Money\", \"id\": \"item-1494251052639\", \"title\": [ { \"text\": \"付款金额\", \"lang\": \"zh_CN\" } ], \"value\": { \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"new_money\": \"1\", \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Selector\", \"id\": \"Selector-1661149920787\", \"title\": [ { \"text\": \"入账部门\", \"lang\": \"zh_CN\" } ], \"value\": { \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"selector\": { \"type\": \"single\", \"options\": [ { \"key\": \"option-1661149920787\", \"value\": [ { \"text\": \"总经办\", \"lang\": \"zh_CN\" } ] } ], \"op_relations\": [] }, \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Selector\", \"id\": \"item-1494251058811\", \"title\": [ { \"text\": \"付款方式\", \"lang\": \"zh_CN\" } ], \"value\": { \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"selector\": { \"type\": \"single\", \"options\": [ { \"key\": \"option-3742851566\", \"value\": [ { \"text\": \"汇票\", \"lang\": \"zh_CN\" } ] } ], \"op_relations\": [] }, \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Number\", \"id\": \"Number-1661698254112\", \"title\": [ { \"text\": \"银行账号\", \"lang\": \"zh_CN\" } ], \"value\": { \"tips\": [], \"members\": [], \"departments\": [], \"files\": [], \"children\": [], \"stat_field\": [], \"new_number\": \"1\", \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 }, { \"control\": \"Date\", \"id\": \"item-1494251158679\", \"title\": [ { \"text\": \"付款日期\", \"lang\": \"zh_CN\" } ], \"value\": { \"tips\": [], \"members\": [], \"departments\": [], \"date\": { \"type\": \"day\", \"s_timestamp\": \"1659628800000\" }, \"files\": [], \"children\": [], \"stat_field\": [], \"sum_field\": [], \"related_approval\": [], \"students\": [], \"classes\": [], \"docs\": [], \"wedrive_files\": [] }, \"require\": 1 } ] }, \"comments\": [] } }";
        Map<String,Object> dataMap = JSON.parseObject(approvalDetail, Map.class);
        Map<String,Object> infoMap = JSON.parseObject(JSON.toJSONString(dataMap.get("info")), Map.class);
        paymentApplication.setSpNo(Long.parseLong(infoMap.get("sp_no").toString()));
        paymentApplication.setSpStatus(Integer.parseInt(infoMap.get("sp_status").toString()));

    }
}
